package com.jie.sort_by_level.tools;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.context.annotation.Configuration;
import org.springframework.data.redis.core.HashOperations;
import org.springframework.data.redis.core.RedisTemplate;

import java.util.Map;

/**
 * @author jie
 * @date 2019/9/1 -17:20
 */
@Configuration
public class RedisUtils {

    @Autowired
    public RedisTemplate redisTemplate;

    public void set(String key, Map value) {
        HashOperations<String, Object, Object> hashOperations = redisTemplate.opsForHash();
        hashOperations.putAll(key, value);
    }

    public Object get(String key) {
        HashOperations hashOperations = redisTemplate.opsForHash();
        return hashOperations.entries(key);
    }

}
